#include "PoolTable.h"

using namespace Game;

PoolTable::PoolTable(const Size& s, Graphics::Renderable* parent):Drawable(parent)
{
	_size=s;
}

void PoolTable::redraw()
{
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
	glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);

	//Draw this thing in the center
	glBegin(GL_QUADS);
		glTexCoord2f(0.0f,0.0f);
		glNormal3f(0.0f,1.0f,0.0f);
		glVertex3f(-_size.width()/2.0f,0.0f,_size.height()/2.0f);

		glTexCoord2f(0.0f,2.0f);
		glNormal3f(0.0f,1.0f,0.0f);
		glVertex3f(_size.width()/2.0f,0.0f,_size.height()/2.0f);

		glTexCoord2f(6.0f,2.0f);
		glNormal3f(0.0f,1.0f,0.0f);
		glVertex3f(_size.width()/2.0f,0.0f,-_size.height()/2.0f);

		glTexCoord2f(6.0f,0.0f);
		glNormal3f(0.0f,1.0f,0.0f);
		glVertex3f(-_size.width()/2.0f,0.0f,-_size.height()/2.0f);
	glEnd();

	glNormal3f(0.0f,1.0f,0.0f);
}

Size PoolTable::size()
{
	return _size;
}

void PoolTable::setSize(const Size& s)
{
	_size=s;
}
